var windowName = "password";
apiready = function(){
    onWindowShow(function () {
    })
    onWindowHide(function () {
    })
    var Page = createVM("#Page",{
        //页面数据
        oldPasswordRules: [
            { validate: (val) => !!val, message: '必须填写密码'},
            { validate: (val) => val.length >= 3 && val.length <= 30, message: '密码长度大于3小于30'}
        ]
        ,newPasswordRules: [
            { validate: (val) => !!val, message: '必须填写密码'},
            { validate: (val) => val.length >= 3 && val.length <= 30, message: '密码长度大于3小于30'}
        ]
        ,newAgPasswordRules: [
            { validate: (val) => !!val, message: '必须填写密码'},
            { validate: (val) => val.length >= 3 && val.length <= 30, message: '密码长度大于3小于30'},
            { validate: (val) => val === Page.validateForm.new, message: '两次输入的密码不一致'},

        ]
        ,validateForm: {
            'new': '',
            'old': '',
            'newAg': ''
        }
    },{
        //页面方法
        "init":function () {
        }

        ,"submit":function() {
            this.$refs.form.validate().then((result) => {
                console.log('form valid: ', result)
                logJson(result)
                if (result){
                    console.log(this.validateForm);
                    logJson(this.validateForm)
                    apiPost("/app/User/UpdatePassword",this.validateForm,function (res) {
                        logJson(res)
                        showToast(res.message)
                    })

                }else{
                    showToast("账号密码未输入")
                }
            });
        },
    })
    Page.init()
}